﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace GanoESB.Business
{
    public class MessageHandler
    {
        private Type msgType;
        private MethodInfo method;
        private ServiceController sc;

        public MessageHandler(Type msgType, MethodInfo method, ServiceController sc)
        {
            this.msgType = msgType;
            this.method = method;
            this.sc = sc;
        }

        public Type MessageType
        {
            get { return msgType; }
        }

        public object Handle(IMessage message)
        {
            return sc.ExecuteMethod(method, message);
        }
    }
}
